package com.dddd.blog.bloguser.config;

import com.aliyun.oss.OSSClient;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 喵星球的大橘
 */
@Configuration
public class OssClientConfig {

    @Value("${aliyun.oss.endPoint}")
    private String endPoint;

    @Value("${aliyun.accessKeyId}")
    private String accessKeyId;

    @Value("${aliyun.accessKeySecret}")
    private String accessKeySecret;

//    @Value("${aliyun.oss.urlPrefix}")
//    private String urlPrefix;

    @Bean
    public OSSClient createOSSClient(){
        return (OSSClient) new OSSClientBuilder().build(endPoint,accessKeyId,accessKeySecret);
    }
}
